  <!-- component 组件不添加name属性在使用动态路由匹配时可能会出现路由匹配错误、重复匹配，菜单闪动等问题 -->

<template>
  <router-view v-slot="{ Component, route }">
    <transition>
      <keep-alive>
        <component :is="Component" :name="route.path" />
      </keep-alive>
    </transition>
  </router-view>
</template>

<script setup lang="ts">
import { provide } from 'vue'
import * as lodash from 'lodash';//lodash 工具库

//将lodash添加到全局属性，方便子组件使用
provide('lodash', lodash);
</script>

<style scoped></style>
